#include <stdio.h>
#include <conio.h>
#include <math.h>
 int main (int argc, char **argv) {
		int sum = 0,temp,k=0,p;
		double  a, i,j, fractpart, intpart, param;
		printf ("Enter number: ");
		scanf ("%lf", &a);
    if ( isdigit(a) ){  
        printf("number is - %lf\n", a);
      }
    else{
      printf("Usage : \t%s numbers\n", argv[1]);
      return 0;
    }

		fractpart = modf (a , &intpart);
		printf ("%lf = %lf + %lf \n", a, intpart, fractpart);

		temp = (int)intpart;
		  do{

			p = temp%10;
			temp = temp/10;
			sum += p;
			
			 printf("temp / 10 - %d\n", p);
			 
			 printf("number is - %d\n", sum);
		 }while ( temp > 0 ); 
		 
		 /* a = fractpart;
		 do{
		 
			
		    k++;
			
			printf("a - %f\n", a);
			i = a*10;
			printf("i - %f\n", i);
			fractpart = modf (i , &intpart);
			a = i - intpart;
			printf("a - %f\n", a);
			printf("intpart - %f\n", intpart);
			sum += intpart;
			intpart=0;
		 }while ( k ); */
		
		 printf("Sum of digits in number is - %d", sum);

         return 0;
 }